import Vue from 'vue';
import App from './App';
import router from './router';
import store from './store';
import '@/assets/css/reset.css';
import '@/assets/font/iconfont.css';
import './plugins/element';
import Router from 'vue-router';
import config from '@/common/config/config';
import api from '@/api';

// 在main.js里引入全局自定义指令
import * as directives from '@/directives';

// 循环遍历使用每一个自定义指令
Object.keys(directives).forEach(key => Vue.directive(key, directives[key]));

// 将二次封装的配置挂载在Vue的根实例下
Vue.prototype.$conf = config;

// 将二次封装的axios挂载在Vue的根实例下
Vue.prototype.$axios = api;

// 关闭生产提示
Vue.config.productionTip = false;

// 解决Router报错的问题
const originalPush = Router.prototype.push;
Router.prototype.push = function push (location) {
    return originalPush.call(this, location).catch(err => err);
};

// 启动Vue应用
new Vue({
    router,
    store,
    render: h => h(App)
}).$mount('#app');
